package com.starview.star.operators.string.runtime;

import com.starview.platform.data.EvaluationException;
import com.starview.platform.data.IFunction;
import com.starview.platform.data.IValue;
import com.starview.platform.data.type.IType;
import com.starview.platform.data.type.StandardTypes;
import com.starview.platform.data.type.TypeUtils;
import com.starview.platform.data.value.Factory;
import com.starview.star.operators.CafeEnter;



public class KeyGenerate implements IFunction
{
  private static int counter = 0;

  @Override
  public IValue enter(IValue... args) throws EvaluationException
  {
    return Factory.newInt(enter());
  }

  @CafeEnter
  public static int enter()
  {
    return counter++;
  }

  @Override
  public IType getType()
  {
    return TypeUtils.functionType(StandardTypes.rawIntegerType);
  }

}
